#include <iostream>
#include <algorithm>
using namespace std;

int n, m;
string a, b;
int i, j;

int main()
{
	cin >> n >> m;
	cin >> a >> b;
	sort(b.begin(), b.end());
	for(int j = 0; j < b.size(); j++) {
		while(i < a.size() && a[i] <= b[j]) i++;
		string tmp = "";
		tmp += b[j];
		if(i >= a.size()) a += tmp;
		else a.insert(i, tmp);
	}
	cout << a;
	return 0;
}
